import request from "@/utils/request";

/**
 * 分页查询商品
 */
export async function searchPageProducts(params) {
  const res = await request.get("/search/product", { params });
  if (res.data.code === 200) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 类型映射列表
 * @param {*} params
 * @returns
 */
export async function searchListTypes(params) {
  const res = await request.get("/search/type", { params });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 导出字段映射列表
 * @param {*} params
 * @returns
 */
export async function searchListExports(params) {
  const res = await request.get("/search/export", { params });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
